package cn.edu.nju.software.zp13.client.assignment9UsingJAXB.assignment4Refactoring.scoreList1;

import java.io.File;

import javax.xml.transform.stream.StreamSource;

import cn.edu.nju.software.zp13.client.assignment3.xmlGenerator.XmlGenerator;
import cn.edu.nju.software.zp13.client.assignment9UsingJAXB.assignment3Refactoring.bean.Students;
import cn.edu.nju.software.zp13.client.assignment9UsingJAXB.assignment4Refactoring.bean.CourseScoreList;
import cn.edu.nju.software.zp13.client.assignment9UsingJAXB.assignment4Refactoring.scoreList1.core.StudentsDeserializer;
import cn.edu.nju.software.zp13.client.assignment9UsingJAXB.assignment4Refactoring.scoreList1.core.StudentsToCourseScoreList;
import cn.edu.nju.software.zp13.client.assignment9UsingJAXB.assignment4Refactoring.scoreList2.core.CourseScoreListSerializer;
import cn.edu.nju.software.zp13.client.assignment9UsingJAXB.assignment4Refactoring.scoreList2.core.EmptyExtraXmlContent;

public class Main {
	public static void main(String[] args) {
		String prefix = System.getProperty("user.dir");
		StudentsToCourseScoreList stuToScore = new StudentsToCourseScoreList();
		Students s=StudentsDeserializer
				.run(new StreamSource(new File(prefix
						+ "/xml/refactoring/studentList2.xml")));
		System.out.println(s.getStudents().size());
		CourseScoreList scoreList = stuToScore.tansfer(s);
		System.out.println(scoreList.getCs().length);
		XmlGenerator xg = new XmlGenerator();
		xg.setDom(CourseScoreListSerializer.serializeToDom(scoreList));
		xg.setXmlContent(new EmptyExtraXmlContent());
		xg.createXml(prefix + "/xml/refactoring/scoreList1.xml");
	}
}
